package com.chapter14.set_;

/**
 * @author 宋鑫宇
 * @version 1.0
 * HashSet的方法
 */
public class HashSet_ {
    public static void main(String[] args) {
        //模拟一个hashmap的底层结构
        //创建一个数组，类型是Node[]
        Node[] table = new Node[16];
        System.out.println(table);
        //创建节点
        Node john = new Node("john",null);
        table[2] = john;
        System.out.println(table);
        Node jack = new Node("jack", null);
        john.next = jack;
        System.out.println(table);
    }
}
//代表结点存储数据
class Node{
    Object item;
    Node next;

    public Node(Object item, Node next) {
        this.item = item;
        this.next = next;
    }

    public Node(Object item) {
        this.item = item;
    }

    @Override
    public String toString() {
        return "Node{" +
                "item=" + item +
                ", next=" + next +
                '}';
    }
}
